package com.zelin.service.impl;

import com.zelin.dao.UserDao;
import com.zelin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * ------------------------------
 * 功能：
 * 作者：WF
 * 微信：hbxfwf13590332912
 * 创建时间：2021/10/14-14:50
 * ------------------------------
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;


    @Override
    public void trans(int from, int to, int money) {
        //1. 转出
        userDao.updateAccount(from,money);
        int i = 10 / 0;
        //2. 转入
        userDao.updateAccount(to,-money);

    }
}
